package telas.componentes;

import javax.swing.JButton;
import business.seguranca.Usuario;
import java.awt.Dimension;

public class Botao extends JButton 
{
	private static final long serialVersionUID = 6625519610367331413L;
	private int controleAcesso = 1;

	/**
	 * This method initializes 
	 * 
	 */
	public Botao() 
	{
		super();
		initialize();
	}

	/**
	 * This method initializes this
	 * 
	 */
	private void initialize() 
	{
        this.setSize(new Dimension(66, 23));
        this.setPreferredSize(new Dimension(66, 23));
	}

	public int getControleAcesso() 
	{
		return controleAcesso;
	}

	public void setControleAcesso(int controleAcesso) 
	{
		this.controleAcesso = controleAcesso;
		
		if( Usuario.getUsuarioSessao().getTipoUsuario().getCodigo() >= controleAcesso )
		{
			setEnabled(true);
		}
		else
		{
			setEnabled(false);
		}
	}
}
